<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 6/7/21
 * Time: 12:14 AM
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\model\Store;
use app\api\model\StoreUser as StoreUserModel;
use app\api\service\Token as TokenService;

class Sale extends BaseController
{
    // 个人销售额
    public function getStoreUser()
    {
        $uid = TokenService::getCurrentUid();
        $storeUser = StoreUserModel::where('user_id',$uid)->find();
        $store = Store::get($storeUser['store_id']);
    }

    /**
     * 二维数组根据某个字段排序
     * @param array $array 要排序的数组
     * @param string $keys   要排序的键字段
     * @param string $sort  排序类型  SORT_ASC     SORT_DESC
     * @return array 排序后的数组
     */
    public function arraySort($array, $keys, $sort = SORT_DESC) {
        $keysValue = [];
        foreach ($array as $k => $v) {
            $keysValue[$k] = $v[$keys];
        }
        array_multisort($keysValue, $sort, $array);
        return $array;
    }
}